package com.ltx.blog_bam.service;


import com.ltx.blog_bam.entity.dto.BlogInfo;
import com.ltx.blog_bam.mapper.BLogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BlogService {
    @Autowired
    private BLogMapper bLogMapper;
    @Autowired
    private RedisTemplate redisTemplate;

    /***
     * 查找到所有的redis中的新blogId
     * @return
     */
    public List<Integer> GetAllBlogId(){
       return (List<Integer>)redisTemplate.opsForList().range("Check_blog",0,-1);
    }

    public List<BlogInfo> CheckBlogInfo(){
        List<Integer> list = GetAllBlogId();
        return bLogMapper.CheckBlogInfo(list);
    }

    /***
     * 删除指定的博客
     * @param BlogId
     */
    public void delBlog(int BlogId){
        bLogMapper.delBlog(BlogId);
    }

}
